#pragma once

#include <linux/lockdep_types.h>

#define lockdep_assert_held(l)
#define lockdep_unpin_lock(l, c)
#define lockdep_init_map(lock, name, key, sub)
#define lockdep_set_class_and_name(lock, key, name)
#define lockdep_init_map_wait(lock, name, key, sub, inner)

#define mutex_acquire(l, s, t, i)
#define mutex_acquire_nest(l, s, t, n, i)
#define mutex_release(l, i)

#define lock_contended(lockdep_map, ip) \
    do                                  \
    {                                   \
    } while (0)
#define lock_acquired(lockdep_map, ip) \
    do                                 \
    {                                  \
    } while (0)

#define lockdep_assert(c) \
    do                    \
    {                     \
    } while (0)

#define rwsem_acquire(l, s, t, i)
#define rwsem_acquire_nest(l, s, t, n, i)
#define rwsem_acquire_read(l, s, t, i)
#define rwsem_release(l, i)
#define lock_downgrade(l, i) \
    do                       \
    {                        \
    } while (0)

#define LOCK_CONTENDED(_lock, try, lock)                 \
    do                                                   \
    {                                                    \
        if (!try(_lock))                                 \
        {                                                \
            lock_contended(&(_lock)->dep_map, _RET_IP_); \
            lock(_lock);                                 \
        }                                                \
        lock_acquired(&(_lock)->dep_map, _RET_IP_);      \
    } while (0)

#define LOCK_CONTENDED_RETURN(_lock, try, lock)          \
    ({                                                   \
        int ____err = 0;                                 \
        if (!try(_lock))                                 \
        {                                                \
            lock_contended(&(_lock)->dep_map, _RET_IP_); \
            ____err = lock(_lock);                       \
        }                                                \
        if (!____err)                                    \
            lock_acquired(&(_lock)->dep_map, _RET_IP_);  \
        ____err;                                         \
    })

#define lockdep_assert_preemption_enabled()

#define lockdep_set_class(lock, key) \
    do                               \
    {                                \
        (void)(key);                 \
    } while (0)
